package org.example.hive3.job;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class EtlMapper extends Mapper<LongWritable, Text, Text, NullWritable> {
    private Text outk = new Text();
    @Override
    protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, Text, NullWritable>.Context context) throws IOException, InterruptedException {
        String srcData = value.toString();
        String etlData = EtlUtils.etlVideoData(srcData);
        if (etlData == null) {
            outk.set(etlData);
            context.write(outk, NullWritable.get());
        }
    }
}
